//
//  GameController.m
//  TribleWar
//
//  Created by ＣＳＴ ＣＳＴ on 8/8/12.
//  Copyright (c) 2012 ＣＳＴ. All rights reserved.
//

#import "GameController.h"

@implementation GameController
@synthesize curCoor;
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.curCoor = CGPointMake(160, 240);
        self.backgroundColor = [UIColor whiteColor];
    }
    return self;
}


// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(showPlayer) userInfo:nil repeats:YES];
    
}



- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];
    CGPoint pos = [touch locationInView:self];
    NSLog(@"touch.x = %f, touch.y = %f", pos.x, pos.y);
    self.curCoor = pos;
}

- (void)showPlayer
{
    UIImage *image = [UIImage imageNamed:@"Ball.png"];
    [image drawAtPoint:self.curCoor]; 
}

-(void)dealloc
{
    [super dealloc]; 
}
@end
